/*
package com.bupt.secret.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.sun.jna.Structure;
import java.io.IOException;
import java.lang.reflect.Field;

public class StructureSerializer extends JsonSerializer<Structure> {

    @Override
    public void serialize(Structure structure, JsonGenerator jsonGenerator, SerializerProvider unused) throws IOException {
        jsonGenerator.writeStartObject();
        Field[] fields = structure.getClass().getDeclaredFields();
        for (Field field : fields) {
            field.setAccessible(true); // 通过反射访问私有字段
            try {
                Object fieldValue = field.get(structure);
                jsonGenerator.writeObjectField(field.getName(), fieldValue);
            } catch (IllegalAccessException e) {
                // 处理异常，例如跳过无法访问的字段或记录错误
            }
        }
        jsonGenerator.writeEndObject();
    }
}*/
